﻿/*
Copyright (c) 2008 Ryan BB Schreiber, Brendan G Fry

Permission is hereby granted, free of charge, to any person obtaining a copy of 
this software and associated documentation files (the "Software"), to deal in 
the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of the Software, and to permit persons to whom the Software is furnished to do 
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
*/
using System;
using Castle.ActiveRecord;

namespace Darkside.GeneratorStudio.Library.Domain
{
    //TODO: Only gets tables and views. Modify this to get synonyms that are mapped to tables and views...
    [Serializable]
    [ActiveRecord("sysobjects", Where = "xtype IN ('u','v') AND [name] != 'sysdiagrams' AND [name] != 'dtproperties'")]
    public partial class Table: ActiveRecordBase<Table>
    {
        [PrimaryKey(Generator = PrimaryKeyType.Assigned, Column = "id")]
        public int Id { get; set; }

        [Property(Column = "name")]
        public string Name { get; set; }

        [Property(Column = "xtype")]
        public string XType { get; set; }

        [Property(Column = "uid")]
        public int UserId { get; set; }

        [Property(Column = "info")]
        public int Info { get; set; }

        [Property(Column = "status")]
        public int Status { get; set; }

        [Property(Column = "base_schema_ver")]
        public int BaseSchemaVersion { get; set; }

        [Property(Column = "replinfo")]
        public int ReplInfo { get; set; }

        [Property(Column = "parent_obj")]
        public int ParentObj { get; set; }

        [Property(Column = "crdate")]
        public DateTime CreatedDate { get; set; }

        [Property(Column = "ftcatid")]
        public byte FtCatId { get; set; }

        [Property(Column = "schema_ver")]
        public int SchemaVersion { get; set; }

        [Property(Column = "stats_schema_ver")]
        public int StatisticsSchemaVersion { get; set; }

        [Property(Column = "type")]
        public string Type { get; set; }

        [Property(Column = "userstat")]
        public byte UserStat { get; set; }

        [Property(Column = "sysstat")]
        public byte SysStat { get; set; }

        [Property(Column = "indexdel")]
        public byte IndexDel { get; set; }

        [Property(Column = "refdate")]
        public DateTime RefDate { get; set; }

        [Property(Column = "version")]
        public int Version { get; set; }

        [Property(Column = "deltrig")]
        public int DeleteTrigger { get; set; }

        [Property(Column = "instrig")]
        public int InsertTrigger { get; set; }

        [Property(Column = "updtrig")]
        public int UpdateTrigger { get; set; }

        [Property(Column = "seltrig")]
        public int SelectTrigger { get; set; }

        [Property(Column = "category")]
        public int Category { get; set; }

        [Property(Column = "cache")]
        public byte Cache { get; set; }

    }
}
